3.153 \(\int \frac{\cos ^2(c+d x)}{a \cos (c+d x)+i a \sin (c+d x)} \, dx\)

Optimal. Leaf size=52 \[ -\frac{\sin ^3(c+d x)}{3 a d}+\frac{\sin (c+d x)}{a d}+\frac{i \cos ^3(c+d x)}{3 a d} \]

[Out]

((I/3)*Cos[c + d*x]^3)/(a*d) + Sin[c + d*x]/(a*d) - Sin[c + d*x]^3/(3*a*d)

________________________________________________________________________________________

Rubi [A]  time = 0.120334, antiderivative size = 52, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 5, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.161, Rules used = {3092, 3090, 2633, 2565, 30} \[ -\frac{\sin ^3(c+d x)}{3 a d}+\frac{\sin (c+d x)}{a d}+\frac{i \cos ^3(c+d x)}{3 a d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2/(a*Cos[c + d*x] + I*a*Sin[c + d*x]),x]

[Out]

((I/3)*Cos[c + d*x]^3)/(a*d) + Sin[c + d*x]/(a*d) - Sin[c + d*x]^3/(3*a*d)

Rule 3092

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symb
ol] :> Dist[a^n*b^n, Int[Cos[c + d*x]^m/(b*Cos[c + d*x] + a*Sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d, m},
x] && EqQ[a^2 + b^2, 0] && ILtQ[n, 0]

Rule 3090

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Sym
bol] :> Int[ExpandTrig[cos[c + d*x]^m*(a*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] &&
 IntegerQ[m] && IGtQ[n, 0]

Rule 2633

Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[Expand[(1 - x^2)^((n - 1)/2), x], x], x
, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]

Rule 2565

Int[(cos[(e_.) + (f_.)*(x_)]*(a_.))^(m_.)*sin[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> -Dist[(a*f)^(-1), Subst[
Int[x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Cos[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2]
 &&  !(IntegerQ[(m - 1)/2] && GtQ[m, 0] && LeQ[m, n])

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rubi steps

\begin{align*} \int \frac{\cos ^2(c+d x)}{a \cos (c+d x)+i a \sin (c+d x)} \, dx &=-\frac{i \int \cos ^2(c+d x) (i a \cos (c+d x)+a \sin (c+d x)) \, dx}{a^2}\\ &=-\frac{i \int \left (i a \cos ^3(c+d x)+a \cos ^2(c+d x) \sin (c+d x)\right ) \, dx}{a^2}\\ &=-\frac{i \int \cos ^2(c+d x) \sin (c+d x) \, dx}{a}+\frac{\int \cos ^3(c+d x) \, dx}{a}\\ &=\frac{i \operatorname{Subst}\left (\int x^2 \, dx,x,\cos (c+d x)\right )}{a d}-\frac{\operatorname{Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (c+d x)\right )}{a d}\\ &=\frac{i \cos ^3(c+d x)}{3 a d}+\frac{\sin (c+d x)}{a d}-\frac{\sin ^3(c+d x)}{3 a d}\\ \end{align*}

Mathematica [A]  time = 0.0712707, size = 73, normalized size = 1.4 \[ \frac{3 \sin (c+d x)}{4 a d}+\frac{\sin (3 (c+d x))}{12 a d}+\frac{i \cos (c+d x)}{4 a d}+\frac{i \cos (3 (c+d x))}{12 a d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2/(a*Cos[c + d*x] + I*a*Sin[c + d*x]),x]

[Out]

((I/4)*Cos[c + d*x])/(a*d) + ((I/12)*Cos[3*(c + d*x)])/(a*d) + (3*Sin[c + d*x])/(4*a*d) + Sin[3*(c + d*x)]/(12
*a*d)

________________________________________________________________________________________

Maple [A]  time = 0.11, size = 75, normalized size = 1.4 \begin{align*} 2\,{\frac{1}{ad} \left ( -1/3\, \left ( \tan \left ( 1/2\,dx+c/2 \right ) -i \right ) ^{-3}+{\frac{i/2}{ \left ( \tan \left ( 1/2\,dx+c/2 \right ) -i \right ) ^{2}}}+3/4\, \left ( \tan \left ( 1/2\,dx+c/2 \right ) -i \right ) ^{-1}+1/4\, \left ( \tan \left ( 1/2\,dx+c/2 \right ) +i \right ) ^{-1} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2/(a*cos(d*x+c)+I*a*sin(d*x+c)),x)

[Out]

2/d/a*(-1/3/(tan(1/2*d*x+1/2*c)-I)^3+1/2*I/(tan(1/2*d*x+1/2*c)-I)^2+3/4/(tan(1/2*d*x+1/2*c)-I)+1/4/(tan(1/2*d*
x+1/2*c)+I))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a*cos(d*x+c)+I*a*sin(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 0.465694, size = 122, normalized size = 2.35 \begin{align*} \frac{{\left (-3 i \, e^{\left (4 i \, d x + 4 i \, c\right )} + 6 i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i\right )} e^{\left (-3 i \, d x - 3 i \, c\right )}}{12 \, a d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a*cos(d*x+c)+I*a*sin(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(-3*I*e^(4*I*d*x + 4*I*c) + 6*I*e^(2*I*d*x + 2*I*c) + I)*e^(-3*I*d*x - 3*I*c)/(a*d)

________________________________________________________________________________________

Sympy [A]  time = 0.441612, size = 128, normalized size = 2.46 \begin{align*} \begin{cases} \frac{\left (- 24 i a^{2} d^{2} e^{5 i c} e^{i d x} + 48 i a^{2} d^{2} e^{3 i c} e^{- i d x} + 8 i a^{2} d^{2} e^{i c} e^{- 3 i d x}\right ) e^{- 4 i c}}{96 a^{3} d^{3}} & \text{for}\: 96 a^{3} d^{3} e^{4 i c} \neq 0 \\\frac{x \left (e^{4 i c} + 2 e^{2 i c} + 1\right ) e^{- 3 i c}}{4 a} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2/(a*cos(d*x+c)+I*a*sin(d*x+c)),x)

[Out]

Piecewise(((-24*I*a**2*d**2*exp(5*I*c)*exp(I*d*x) + 48*I*a**2*d**2*exp(3*I*c)*exp(-I*d*x) + 8*I*a**2*d**2*exp(
I*c)*exp(-3*I*d*x))*exp(-4*I*c)/(96*a**3*d**3), Ne(96*a**3*d**3*exp(4*I*c), 0)), (x*(exp(4*I*c) + 2*exp(2*I*c)
 + 1)*exp(-3*I*c)/(4*a), True))

________________________________________________________________________________________

Giac [A]  time = 1.12533, size = 90, normalized size = 1.73 \begin{align*} \frac{\frac{3}{a{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + i\right )}} + \frac{9 \, \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 12 i \, \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 7}{a{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - i\right )}^{3}}}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a*cos(d*x+c)+I*a*sin(d*x+c)),x, algorithm="giac")

[Out]

1/6*(3/(a*(tan(1/2*d*x + 1/2*c) + I)) + (9*tan(1/2*d*x + 1/2*c)^2 - 12*I*tan(1/2*d*x + 1/2*c) - 7)/(a*(tan(1/2
*d*x + 1/2*c) - I)^3))/d